from django.conf import settings
from django.conf.urls.defaults import *

urlpatterns = patterns('',
                       # contrib
                       (r'^a/settings/', include('dbsettings.urls')),
                       )

# serve media for runserver
if settings.LOCAL_DEV:
    urlpatterns += patterns('',
        (r'^%s/(?P<path>.*)$' % settings.MEDIA_URL.strip('/'), 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
    )

# contrib
urlpatterns += patterns('',
                        (r'^accounts/', include('registration.urls')),
                        )

# django admin
urlpatterns += patterns('',
        # django admin
        (r'^admin/', include('django.contrib.admin.urls')),
        (r'^i18n/', include('django.conf.urls.i18n')),
        (r'^jsi18n/(?P<packages>\S+?)/$', 'django.views.i18n.javascript_catalog'),
        (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages': 'django.conf'}),
        (r'^r/', include('django.conf.urls.shortcut')),
        (r'^logout/?$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
        (r'^login/?$', 'django.contrib.auth.views.login'),
    )
